package com.lc.afbx.conn;

import com.zcx.helper.http.AsyCallBack;
import com.zcx.helper.http.note.HttpInlet;

import org.json.JSONObject;

/**
 * Created by Administrator on 2016/6/1.
 */
@HttpInlet(Conn.INLET_API_MINE_ADDRESS_DEFAULT)
public class GetApiDefaultAddress extends BaseAsyGet<GetApiDefaultAddress.Info>{
    public String userid;
    public GetApiDefaultAddress(AsyCallBack<GetApiDefaultAddress.Info> asyCallBack) {
        super(asyCallBack);
    }

    protected Info parser(JSONObject jsonObject) {

        TOAST = jsonObject.optString("message");
        if (jsonObject.optInt("code") == 200) {

            Info info = new Info();
            JSONObject o = jsonObject.optJSONObject("data");

            Data d = new Data();
            d.id = o.optString("id");
            d.rec_name = o.optString("rec_name");
            d.cur_address = o.optString("cur_address");
            d.road_address = o.optString("road_address");
            d.phone = o.optString("phone");
            d.is_first = o.optString("is_first");

            info.data = d;

            return info;
        }
        return null;
    }

    public static class Info {

        public Data data;
    }
    public static class Data {
        public String id, rec_name,cur_address,road_address,phone,is_first;
    }
}
